package com.iretailer.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iretailer.mapper.DeviceMapper;
import com.iretailer.model.Device;
import com.iretailer.model.SiteDevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceService extends ServiceImpl<DeviceMapper, Device> {

    @Autowired
    private DeviceMapper deviceMapper;

    public List<SiteDevice> selectAllSiteDevice(Integer siteStatus, Integer deviceStatus) {
        return deviceMapper.selectAllSiteDevice(siteStatus, deviceStatus);
    }

    public SiteDevice selectSiteDeviceBySiteName_DeviceName(String siteName, String deviceName) {
        List<SiteDevice> list = deviceMapper.selectSiteDeviceBySiteName_DeviceName(siteName, deviceName);
        if (list != null && list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }
}
